package com.soap.desensitize.encry.json;

import com.soap.desensitize.encry.IDesensitization;
import com.soap.desensitize.exception.strategy.DecodeException;
import com.soap.desensitize.exception.strategy.EncodeException;

/**
 * @desc 	json加密抽象基类
 * @author 	高增源
 * @time	2022-04-20
 */
public abstract class AbstractJsonEncry<T> {
    protected IDesensitization encry;
    public AbstractJsonEncry(IDesensitization encry) {
        this.encry=encry;
    }

    /**
     * @desc  根据密码加密
     * @param data
     * @return
     */
    public abstract String encode(T data) throws EncodeException;

    /**
     * @desc  根据密码解密
     * @param data
     * @return
     */
    public abstract T decode(String data) throws DecodeException;
    public IDesensitization getEncry() {
        return encry;
    }
    public void setEncry(IDesensitization encry) {
        this.encry = encry;
    }
}
